
datablock ExplosionData(FlakCannonRecoilExplosion) {
	faceViewer     = true;
	explosionScale = "1 1 1";
	
	shakeCamera = true;
	camShakeFreq = "8.0 8.0 8.0";
	camShakeAmp = "2.0 2.0 2.0";
	camShakeDuration = 1.0;
	camShakeRadius = 10.0;
};
datablock ProjectileData(FlakCannonRecoilProjectile) {
	projectileShapeName = "base/data/shapes/empty.dts";
	explosion = FlakCannonRecoilExplosion;
	lifetime = 0;
	explodeOnDeath = true;
};

datablock AudioProfile(FlakCannonShotSound) {
	filename = "./flakcannonfire.wav";
	description = AudioDefault3d;
	preload = true;
};

datablock PlayerData(PlayerInFlakCannonArmor : PlayerStandardArmor) {
	minLookAngle = -0.95;
	maxLookAngle = -0.15;
	uiName = "";
};

datablock PlayerData(FlakCannonArmor) {
	renderFirstPerson = true;
	emap = false;
	
	className = Armor;
	shapeFile = "./flakcannon.dts";
	cameraMaxDist = 8;
	cameraTilt = 0.261;
	cameraVerticalOffset = 2.3;
	 
	cameraDefaultFov = 90.0;
	cameraMinFov = 5.0;
	cameraMaxFov = 120.0;
	
	//debrisShapeName = "~/data/player/debris_player.dts";
	//debris = horseDebris;
	
	aiAvoidThis = true;
	
	minLookAngle = -0.95;
	maxLookAngle = -0.15;
	maxFreelookAngle = 3.0;
	
	useEyePoint = 1;
	
	mass = 200000;
	drag = 1;
	density = 5;
	maxDamage = 250;
	maxEnergy =  10;
	repairRate = 0.33;
	
	rechargeRate = 0.4;
	
	runForce = 1000;
	runEnergyDrain   = 0;
	minRunEnergy     = 0;
	maxForwardSpeed  = 0;
	maxBackwardSpeed = 0;
	maxSideSpeed     = 0;
	
	maxForwardCrouchSpeed  = 0;
	maxBackwardCrouchSpeed = 0;
	maxSideCrouchSpeed     = 0;
	
	maxUnderwaterForwardSpeed  = 0;
	maxUnderwaterBackwardSpeed = 0;
	maxUnderwaterSideSpeed     = 0;
	
	jumpForce       = 0; 
	jumpEnergyDrain = 0;
	minJumpEnergy   = 0;
	jumpDelay       = 0;
	
	minJetEnergy   = 0;
	jetEnergyDrain = 0;
	canJet         = 0;
	
	minImpactSpeed   = 250;
	speedDamageScale = 3.8;
	
	boundingBox			= vectorScale("2.9 2.9 1.5", 4); 
	crouchBoundingBox	= vectorScale("2.9 2.9 1.5", 4); 
	
	pickupRadius = 0.75;
	
	jetEmitter        = "";
	jetGroundEmitter  = "";
	jetGroundDistance = 4;
	
	footPuffNumParts = 10;
	footPuffRadius = 0.25;
	
	splash = PlayerSplash;
	splashVelocity = 4.0;
	splashAngle = 67.0;
	splashFreqMod = 300.0;
	splashVelEpsilon = 0.60;
	bubbleEmitTime = 0.1;
	splashEmitter[0] = PlayerFoamDropletsEmitter;
	splashEmitter[1] = PlayerFoamEmitter;
	splashEmitter[2] = PlayerBubbleEmitter;
	mediumSplashSoundVelocity = 10.0;   
	hardSplashSoundVelocity = 20.0;   
	exitSplashSoundVelocity = 5.0;
	
	runSurfaceAngle  = 85;
	jumpSurfaceAngle = 86;
	
	minJumpSpeed = 20;
	maxJumpSpeed = 30;
	
	horizMaxSpeed = 68;
	horizResistSpeed = 33;
	horizResistFactor = 0.35;
	
	upMaxSpeed = 80;
	upResistSpeed = 25;
	upResistFactor = 0.3;
	
	footstepSplashHeight = 0.35;
	
	JumpSound = "";
	
	groundImpactMinSpeed = 10.0;
	groundImpactShakeFreq = "4.0 4.0 4.0";
	groundImpactShakeAmp = "1.0 1.0 1.0";
	groundImpactShakeDuration = 0.8;
	groundImpactShakeFalloff = 10.0;
	
	maxItems = 10;
	maxWeapons = 5;
	maxTools = 5;
	
	uiName = "Flak Cannon";
	rideable = true;
	lookUpLimit = 0.5;
	lookDownLimit = 0.3;
	
	canRide = false;
	showEnergyBar = false;
	paintable = true;
	
	brickImage = horseBrickImage;
	
	numMountPoints = 1;
	mountThread[0] = "sit";
	
	protectPassengersBurn   = true;
	protectPassengersRadius = false;
	protectPassengersDirect = false;
	
	useCustomPainEffects = true;
	PainHighImage = "";
	PainMidImage  = "";
	PainLowImage  = "";
	painSound     = "";
	deathSound    = "";
	
	deathExplosionProjectile = FlakCannonExplosionProjectile;
	
	numFixedGuns = 1;
	fixedGunOperatorSlot [0] = 0;
	fixedGunTrigger      [0] = 0;
	fixedGunSlot         [0] = 1;
	fixedGunForwardOffset[0] = 0;
	fixedGunShotTimeMs   [0] = 200;
	fixedGunIsAutomatic  [0] = 1;
	fixedGunProjectile   [0] = FlakShellProjectile;
	fixedGunRecoilImpulse[0] = 300;
	fixedGunFireSound    [0] = FlakCannonShotSound;
	fixedGunFireAnimation[0] = "fire";
	fixedGunReadySound   [0] = "";
	fixedGunEmitterImage [0] = FlakCannonSmokeImage;
	fixedGunEmitterTimeMs[0] = 500;
	fixedGunFireCallback [0] = "";
	fixedGunReadyCallback[0] = "";
	
	slotPlayerDatablock[0] = PlayerInFlakCannonArmor;
	slotDisableTools[0] = 1;
};

datablock ParticleData(FlakCannonSmokeParticle) {
	dragCoefficient      = 3;
	gravityCoefficient   = -1;
	inheritedVelFactor   = 0.6;
	constantAcceleration = 0.0;
	lifetimeMS           = 300;
	lifetimeVarianceMS   = 100;
	textureName          = "base/data/particles/cloud";
	spinSpeed     = 10.0;
	spinRandomMin = -500.0;
	spinRandomMax = 500.0;
	colors[0] = "0.5 0.5 0.5 0.1";
	colors[1] = "0.5 0.5 0.5 0.0";
	sizes[0]  = 0.6;
	sizes[1]  = 0.8;
	
	useInvAlpha = true;
};

datablock ParticleEmitterData(FlakCannonSmokeEmitter) {
	ejectionPeriodMS = 10;
	periodVarianceMS = 4;
	ejectionVelocity = 6;
	velocityVariance = 3;
	ejectionOffset   = 0;
	thetaMin         = 130;
	thetaMax         = 180;
	phiReferenceVel  = 0;
	phiVariance      = 360;
	overrideAdvance = false;
	particles = "FlakCannonSmokeParticle";
	
	uiName = "Flak Cannon Smoke";
};

datablock ParticleData(FlakCannonSmoke2Particle) {
	dragCoefficient      = 4;
	gravityCoefficient   = -0.5;
	inheritedVelFactor   = 0.6;
	constantAcceleration = 0.0;
	lifetimeMS           = 2000;
	lifetimeVarianceMS   = 1000;
	textureName          = "base/data/particles/cloud";
	spinSpeed     = 10.0;
	spinRandomMin = -50.0;
	spinRandomMax = 50.0;
	colors[0] = "0.1 0.1 0.1 0.3";
	colors[1] = "0.3 0.2 0.2 0.1";
	colors[2] = "0.4 0.3 0.3 0.0";
	colors[3] = "0.4 0.3 0.3 0.0";
	sizes[0]  = 1.5;
	sizes[1]  = 4.5;
	sizes[2]  = 5;
	sizes[3]  = 4;
	times[0]  = 0;
	times[1]  = 0.2;
	times[2]  = 0.9;
	times[3]  = 1;
	
	useInvAlpha = true;
};

datablock ParticleEmitterData(FlakCannonSmoke2Emitter) {
	ejectionPeriodMS = 3;
	periodVarianceMS = 2;
	ejectionVelocity = 25;
	velocityVariance = 15;
	ejectionOffset   = 0;
	thetaMin         = 160;
	thetaMax         = 180;
	phiReferenceVel  = 0;
	phiVariance      = 360;
	overrideAdvance = false;
	particles = "FlakCannonSmoke2Particle";
	
	uiName = "Flak Cannon Smoke2";
};

datablock ParticleData(FlakCannonFireParticle) {
	dragCoefficient      = 10;
	gravityCoefficient   = 0;
	inheritedVelFactor   = 0.6;
	constantAcceleration = 0.0;
	lifetimeMS           = 50;
	lifetimeVarianceMS   = 30;
	textureName          = "base/data/particles/star1";
	spinSpeed     = 10.0;
	spinRandomMin = -500.0;
	spinRandomMax = 500.0;
	colors[0] = "1 1 0 1";
	colors[1] = "1 0 0 0.5";
	sizes[0]  = 1.5;
	sizes[1]  = 1.0;
	
	useInvAlpha = true;
};

datablock ParticleEmitterData(FlakCannonFireEmitter) {
	ejectionPeriodMS = 10;
	periodVarianceMS = 4;
	ejectionVelocity = 10;
	velocityVariance = 3;
	ejectionOffset   = 0;
	thetaMin         = 0;
	thetaMax         = 180;
	phiReferenceVel  = 0;
	phiVariance      = 360;
	overrideAdvance = false;
	particles = "FlakCannonFireParticle";
};

datablock ShapeBaseImageData(FlakCannonSmokeImage) {
	shapeFile = "base/data/shapes/empty.dts";
	emap = false;
	
	mountPoint = 1;
	projectile = FlakCannonRecoilProjectile;
	
	stateName[0]                  = "Ready";
	stateTransitionOnTimeout[0]   = "FireA";
	stateTimeoutValue[0]          = 0.01;
	
	stateName[1]                  = "FireA";
	stateTransitionOnTimeout[1]   = "FireB";
	stateWaitForTimeout[1]        = True;
	stateTimeoutValue[1]          = 0.05;
	stateEmitter[1]               = FlakCannonFireEmitter;
	stateEmitterTime[1]           = 0.05;
	stateScript[1]                = onFire;
	
	stateName[2]                  = "FireB";
	stateTransitionOnTimeout[2]   = "FireC";
	stateWaitForTimeout[2]        = True;
	stateTimeoutValue[2]          = 0.05;
	stateEmitter[2]               = FlakCannonSmoke2Emitter; 
	stateEmitterTime[2]           = 0.05;
	
	stateName[3]                  = "FireC";
	stateTransitionOnTimeout[3]   = "Done";
	stateWaitForTimeout[3]        = True;
	stateTimeoutValue[3]          = 1.850;
	stateEmitter[3]               = FlakCannonSmokeEmitter;
	stateEmitterTime[3]           = 1.850;
	
	stateName[4]                  = "Done";
	stateScript[4]                = "onDone";
};
function FlakCannonSmokeImage::onDone(%this, %obj, %slot) {
	%obj.unMountImage(%slot);
}

datablock DebrisData(FlakCannonDebris) {
	emitters = "jeepDebrisTrailEmitter";
	
	shapeFile = "./flakcannon.dts";
	lifetime = 4.5;
	minSpinSpeed = -300.0;
	maxSpinSpeed = 300.0;
	elasticity = 0.5;
	friction = 0.2;
	numBounces = 1;
	staticOnMaxBounce = true;
	snapOnMaxBounce = false;
	fade = true;
	
	gravModifier = 2;
};

datablock ExplosionData(FlakCannonExplosion) {
	//explosionShape = "";
	lifeTimeMS = 150;
	
	soundProfile = vehicleExplosionSound;
	
	emitter[0] = vehicleExplosionEmitter;
	emitter[1] = vehicleExplosionEmitter2;
	
	debris = FlakCannonDebris;
	debrisNum = 1;
	debrisNumVariance = 0;
	debrisPhiMin = 0;
	debrisPhiMax = 360;
	debrisThetaMin = 0;
	debrisThetaMax = 20;
	debrisVelocity = 18;
	debrisVelocityVariance = 3;
	
	faceViewer     = true;
	explosionScale = "1 1 1";
	
	shakeCamera = true;
	camShakeFreq = "7.0 8.0 7.0";
	camShakeAmp = "10.0 10.0 10.0";
	camShakeDuration = 0.75;
	camShakeRadius = 15.0;
	
	lightStartRadius = 0;
	lightEndRadius = 20;
	lightStartColor = "0.45 0.3 0.1";
	lightEndColor = "0 0 0";
	
	impulseRadius = 15;
	impulseForce = 1000;
	impulseVertical = 2000;
	
	radiusDamage = 30;
	damageRadius = 8.0;
	
	playerBurnTime = 5000;
};

datablock ProjectileData(FlakCannonExplosionProjectile) {
	directDamage     = 0;
	radiusDamage     = 0;
	damageRadius     = 0;
	explosion        = FlakCannonExplosion;
	
	directDamageType = $DamageType::jeepExplosion;
	radiusDamageType = $DamageType::jeepExplosion;
	
	explodeOnDeath   = 1;
	
	armingDelay      = 0;
	lifetime         = 10;
};


datablock DebrisData(FlakShellDebris) {
	emitters = "rocketTrailEmitter";
	
	shapeFile = "base/data/shapes/empty.dts";
	lifetime = 0.1;
	minSpinSpeed = -300.0;
	maxSpinSpeed = 300.0;
	elasticity = 0.5;
	friction = 0.2;
	numBounces = 0;
	staticOnMaxBounce = true;
	snapOnMaxBounce = false;
	fade = false;
	
	gravModifier = 0;
};

datablock ParticleData(FlakShellSmokeParticle) {
	dragCoefficient      = 4;
	gravityCoefficient   = -0.5;
	inheritedVelFactor   = 0.6;
	constantAcceleration = 0.0;
	lifetimeMS           = 9000;
	lifetimeVarianceMS   = 4000;
	textureName          = "base/data/particles/cloud";
	spinSpeed      = 10.0;
	spinRandomMin  = -50.0;
	spinRandomMax  = 50.0;
	colors[0] = "0.1 0.1 0.1 0.9";
	colors[1] = "0.6 0.5 0.5 0.0";
	sizes[0]  = 10;
	sizes[1]  = 14;
	
	useInvAlpha = true;
};

datablock ParticleEmitterData(FlakShellExplosionEmitter) {
	ejectionPeriodMS = 20;
	periodVarianceMS = 14;
	ejectionVelocity = 7;
	velocityVariance = 5;
	ejectionOffset   = 0;
	thetaMin         = 0;
	thetaMax         = 180;
	phiReferenceVel  = 0;
	phiVariance      = 360;
	overrideAdvance = false;
	
	particles = "FlakShellSmokeParticle";
};

datablock ParticleData(FlakShellSmoke2Particle) {
	dragCoefficient      = 4;
	gravityCoefficient   = -0.5;
	inheritedVelFactor   = 0.6;
	constantAcceleration = 0.0;
	lifetimeMS           = 8000;
	lifetimeVarianceMS   = 4000;
	textureName          = "base/data/particles/cloud";
	spinSpeed      = 10.0;
	spinRandomMin  = -50.0;
	spinRandomMax  = 50.0;
	colors[0] = "0.1 0.1 0.1 0.9";
	colors[1] = "0.8 0.7 0.5 0.0";
	sizes[0]  = 8;
	sizes[1]  = 18;
	
	useInvAlpha = true;
};

datablock ParticleEmitterData(FlakShellExplosion2Emitter) {
	ejectionPeriodMS = 20;
	periodVarianceMS = 14;
	ejectionVelocity = 7;
	velocityVariance = 5;
	ejectionOffset   = 0;
	thetaMin         = 0;
	thetaMax         = 180;
	phiReferenceVel  = 0;
	phiVariance      = 360;
	overrideAdvance = false;
	
	particles = "FlakShellSmoke2Particle";
};

datablock ExplosionData(FlakShellExplosion) {
	explosionShape = "";
	soundProfile = rocketExplodeSound;
	
	lifeTimeMS = 150;
	
	debris = FlakShellDebris;
	debrisNum = 30;
	debrisNumVariance = 10;
	debrisPhiMin = 0;
	debrisPhiMax = 360;
	debrisThetaMin = 0;
	debrisThetaMax = 180;
	debrisVelocity = 140;
	debrisVelocityVariance = 50;
	
	particleEmitter = FlakShellExplosionEmitter;
	particleDensity = 10;
	particleRadius = 0.2;
	
	emitter[0] = gravityRocketExplosionRingEmitter;
	emitter[1] = gravityRocketExplosionChunkEmitter;
	emitter[2] = FlakShellExplosion2Emitter;
	
	faceViewer     = true;
	explosionScale = "1 1 1";
	
	shakeCamera = true;
	camShakeFreq = "10.0 11.0 10.0";
	camShakeAmp = "3.0 10.0 3.0";
	camShakeDuration = 1.5;
	camShakeRadius = 32.0;
	
	// Dynamic light
	lightStartRadius = 5;
	lightEndRadius = 20;
	lightStartColor = "1 1 0 1";
	lightEndColor = "1 0 0 0";
	
	damageRadius = 10;
	radiusDamage = 35;
	
	impulseRadius = 20;
	impulseForce = 600;
};

AddDamageType("FlakShellDirect",   '<bitmap:add-ons/Projectile_GravityRocket/rocket> %1',    '%2 <bitmap:add-ons/Projectile_GravityRocket/rocket> %1',1,1);
AddDamageType("FlakShellRadius",   '<bitmap:add-ons/Projectile_GravityRocket/rocketRadius> %1',    '%2 <bitmap:add-ons/Projectile_GravityRocket/rocketRadius> %1',1,0);
datablock ProjectileData(FlakShellProjectile) {
	projectileShapeName = "./flakBullet.dts";
	directDamage        = 100;
	directDamageType = $DamageType::flakShellDirect;
	radiusDamageType = $DamageType::flakShellRadius;
	impactImpulse	   = 1000;
	verticalImpulse	   = 1000;
	explosion           = FlakShellExplosion;
	particleEmitter     = rocketTrailEmitter;
	
	brickExplosionRadius = 10;
	brickExplosionImpact = true;          //destroy a brick if we hit it directly?
	brickExplosionForce  = 50;             
	brickExplosionMaxVolume = 60;          //max volume of bricks that we can destroy
	brickExplosionMaxVolumeFloating = 120;  //max volume of bricks that we can destroy if they aren't connected to the ground (should always be >= brickExplosionMaxVolume)
	
	sound = rocketLoopSound;
	
	muzzleVelocity         = 160;
	muzzleVelocityVariance = 20;
	accuracyVariance       = 10;
	velInheritFactor    = 1.0;
	
	armingDelay      = 0;
	lifetime         = 6000;
	fadeDelay        = 6000;
	bounceElasticity = 0.5;
	bounceFriction   = 0.20;
	isBallistic      = true;
	gravityMod = 1;
	
	hasLight    = true;
	lightRadius = 5.0;
	lightColor  = "1 0.5 0.0";
	
	explodeOnDeath = 1;
	
	uiName = "Flak Shell";
	
	proximityFuseDistance      = 25;
	proximityFuseArmingDelayMs = 500;
};
